package com.wjb.config;

import com.wjb.Job.OrderETLJob;
import com.wjb.Job.PlaceOrderSchedule;
import com.wjb.common.OrderETLScheduler;
import org.quartz.JobBuilder;
import org.quartz.JobDetail;
import org.quartz.Trigger;
import org.quartz.TriggerBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import static org.quartz.CronScheduleBuilder.cronSchedule;

/**
 * @author : 王济彬
 * @date: 2025/6/8 - 06 - 08 - 11:28
 * @Description: com.wjb.config
 * @version: 1.0
 */
@Configuration
public class QuartzConfig {

    @Bean
    public JobDetail createJobDetail(){
        return JobBuilder.newJob(OrderETLJob.class)
                .withIdentity("quartzJob","group")
                .storeDurably(true)
                .build();
    }

    @Bean
    public Trigger getTrigger(){
        return TriggerBuilder.newTrigger()
                .forJob(createJobDetail())
                .withIdentity("quartzTrigger","group")
                .startNow()
                .withSchedule(cronSchedule("0/30 * * * * ?"))
                .build();
    }

}
